<template>
  <div class="return-msg" v-if="isShowErrorMsg">
    <div class="return-msg-container">
      <div class="msg-title">商品上架反馈<a-icon @click="onClose" type="close" /></div>
      <div class="msg-container">
        <div class="tips-msg">
          提示：共<span>{{num}}</span>件商品未能成功上架，失败原因如下。
        </div>
        <div class="list-top">
          <span>物料信息</span>
          <span>失败原因</span>
        </div>
        <ul class="tips-list">
          <li v-for="item in data" :key="item.key">
            <div class="item-left">
              <img src="../../../../assets/image/sellerHub/warning_edit.png" alt="">
              <div class="table-name-right">
              <div class="right-item">
                <a-popover>
                  <template slot="content">
                    <div class="goods-msg">
                      <p>物料信息</p>
                      <p><span>物料名称:</span>{{item.materialName}}</p>
                      <p><span>零件号:</span> {{item.materialCode}}</p>
                      <p><span>规格:</span>{{item.specifications}}</p>
                      <p><span>计量单位:</span> {{item.unit}}</p>
                    </div>
                  </template>
                  <span class="textOverflow" style="width:110px;">{{item.materialName}}</span>
                </a-popover>
                <em>|</em>
              <i class="textOverflow" style="width:110px;">零件号:{{item.materialCode}}</i>
              </div>
              <div class="right-item"><span class="item-label">规格：</span><span class="textOverflow" style="width:68px;">{{item.specifications}}</span><em>|</em><span class="item-label">计量单位：</span>{{item.unit}}</div>
            </div>
            </div>
            <div class="item-right">
              {{item.errMsg}}
            </div>
          </li>
        </ul>
      </div>
      <div class="tips-msg-bottom">
        <span>去完善</span>
      </div>
    </div>
  </div>
</template>
<script>
const columns = [
  {
    title: '物料信息',
    dataIndex: 'name',
    scopedSlots: { customRender: 'name' },
  },
  {
    title: '失败原因',
    dataIndex: 'errorMsg',
    scopedSlots: { customRender: 'errorMsg' },
  },
];

export default {
  model: {
    prop: 'isShowErrorMsg',
    event: 'change'
  },
  props: {
    isShowErrorMsg: Boolean,
    errorMsgList: Array,
  },
  data() {
    return {
      data:[],
      columns,
      num:0,
    }
  },
  watch: {
    errorMsgList(_val) {
      this.num = _val.length;
      this.data = _val;
    }
  },
  methods: {
    onClose() {
      this.$emit('change',false)
    },
  },
}
</script>
<style lang="less">
.return-msg {
  background: rgba(0, 0, 0, 0.32);
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999;
  .return-msg-container {
    width: 56%;
    height: 609px;
    background: #fff;
    border-radius: 8px;
    position: absolute;
    top: 50%;
    left: 50%;
    box-shadow: 0px 12px 48px 16px rgba(0,0,0,0.03), 0px 9px 28px 0px rgba(0,0,0,0.05), 0px 6px 16px -8px rgba(0,0,0,0.08); 
    transform: translate(-50%,-50%);
  }
  .msg-title {
    font-size: 16px;
    height: 54px;
    line-height: 54px;
    border-bottom: 1px solid #EBEDF2;
    padding-left: 24px;
    font-weight: 600;
    .anticon {
      font-size: 12px;
      cursor: pointer;
      position: absolute;
      top: 22px;
      right: 27px;
      opacity: 0.8;
    }
  }
  .msg-container {
    width: 100%;
    padding: 24px;
    .tips-msg {
      width: 100%;
      height: 41px;
      background: rgba(255,144,3,0.06);
      border: 1px solid rgba(255,144,3,0.20);
      border-radius: 3px;
      font-size: 12px;
      line-height: 41px;
      padding-left: 48px;
      position: relative;
      margin-bottom:16px; 
      span {
        color: @activeRed;
      }
    }
    .tips-msg::before {
      content: ' ';
      width : 14px;
      height: 14px;
      display: block;
      position: absolute;
      background: url('../../../../assets/image/sellerHub/tips.png') no-repeat center top;
      left: 25px;
      top: 12px;
    }
    .list-top {
      height: 48px;
      background: rgba(16,37,77,0.02);
      border-bottom: 1px solid rgba(39,36,36,0.08);
      line-height: 48px;
      font-size: 14px;
      font-weight: 600;
      padding-left: 16px;
      span {
        width: 50%;
        display: inline-block;
      }
    }
    .tips-list {
      overflow-y: scroll;
      height: 361px;
      li {
        padding: 16px;
        overflow: hidden;
        border-bottom: 1px solid rgba(39,36,36,0.08);
        .item-left,.item-right {
          width: 50%;
          height: 60px;
          float: left;
        }
        .item-left {
          border-right: 1px solid rgba(39,36,36,0.08);
        }
        .item-right {
          line-height: 60px;
          padding-left: 16px;
          span {
            color: @activeRed;
          }
        }
        img {
          display: block;
          width: 60px;
          height: 60px;
          float: left;
          border: 1px solid rgba(34,49,77,0.08);
        }
        .table-name-right {
          float: left;
          margin-left: 12px;
          padding-top: 3px;
          .right-item {
            display: block;
            height: 28px;
            line-height: 28px;
            em {
              color: #f2f2f2;
              margin: 0 8px;
              position: relative;
              top: -1px;
            }
            
          }
        }
      }
      
      
    }
  }
  .tips-msg-bottom {
    width: 100%;
    border-top: 1px solid #F4F5F8;
    text-align: center;
    position: absolute;
    bottom: 0;
    height: 64px;
    text-align: center;
    span{
      display: inline-block;
      height: 32px;
      line-height: 32px;
      color: #fff;
      text-align: center;
      padding: 0 12px;
      background: @activeRed;
      cursor: pointer;
      margin-top: 16px;
    }
  }
}
</style>